import request from './request'

/**
 * 查询用户所有收藏
 */
export const getFavorites = () => {
    return request({
        url: '/api/favorites/findAll',
        method: 'get'
    })
}

/**
 * 取消收藏
 * @param {number} propertyId - 房产ID
 */
export const cancelFavorite = (propertyId) => {
    return request({
        url: '/api/favorites/cancelFavorites',
        method: 'delete',
        params: { propertyId }
    })
}

/**
 * 添加收藏
 * @param {number} propertyId - 房产ID
 */
export const addFavorite = (propertyId) => {
    return request({
        url: '/api/favorites/addFavorites',
        method: 'post',
        data: { propertyId },
        headers: {
            'Content-Type': 'application/json'
        }
    })
}
